<?
//Überprüfen ob der Abruf über die Hauptseite erfolgt
if(!defined('InStern')) exit;
//Avatar ändern
if($_POST['do']=="upload")
{
  $config_upload[]="jpg";
  $config_upload[]="gif";
  $config_upload[]="png";
  $config_width=320;
  $config_height=240;
  $typ = strtolower(substr($_FILES[upload][name], -3));
  $ok=false;
  foreach($config_upload as $v) if($v==$typ) $ok=true;
  //Dateinamen suchen  
  if($ok)
  {
    if(move_uploaded_file($_FILES[upload][tmp_name], "tmp/temp.$typ"))
    {
      if($typ=="jpg") $bild=imagecreatefromjpeg("tmp/temp.$typ");
      if($typ=="gif") $bild=imagecreatefromgif("tmp/temp.$typ");
      if($typ=="png") $bild=imagecreatefrompng("tmp/temp.$typ");
      $format=imagesy($bild)/imagesx($bild);
      $w=$config_width;
      $h=$config_width*$format;
      $h=$config_height;
      $neu=imagecreatetruecolor($w,$h);
      imagecopyresized($neu, $bild, 0,0,0,0,$w,$h,imagesx($bild),imagesy($bild));
      imagejpeg($neu, "data/user/user-".$_SESSION[user][Id].".jpg");
      imagedestroy($neu);
      imagedestroy($bild);
      echo "
      <script type=\"text/javascript\">
       location.href=\"index.php\";
      </script>
      ";    
    }
    else{ 
      echo "<div class=\"error\">$lang[profil_error_upload]</div>";
    }
  }
  else
  {
      echo sprintf("<div class=\"error\">".$lang[profil_error_filetypes],$typ);
      foreach($config_upload as $v) echo " $v ";
      echo "</div>";
  }    
}
//Verify
if(isset($_GET[verify]) AND $_SESSION[user][Profil_Handycode]==""){
    if(preg_match("/^(01)(5|6|7)([0-9])([0-9]{5,12})$/",$_GET[verify])){
	    $string="abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ123456789!";
		$code="";
		for($i=0; $i<7;$i++){
		    $code.=$string[rand(0,strlen($string))];
		}
	    $db->query("UPDATE user SET Profil_Handynummer='$_GET[verify]', Profil_Handycode='$code' WHERE Id=".$_SESSION[user][Id]);
		//send activationcode to user
        $text=sprintf($lang[profil_handy_activationcode], $_SESSION[user][Name], $code);
		sendsms($_GET[verify],$text);	
        logMsg("verifysms",	"'$text' to $_GET[verify]");
    }else{
        //Number not valid
	    echo "<div class=\"error\">".$lang[profil_error_incorrect_number]."</div>";
	}
}
if(isset($_GET[verifycode]) AND $_SESSION[user][Profil_Handycode]!=""){
    if($_SESSION[user][Profil_Handycode]=="ok"){
        //allready verified
	    echo "<div class=\"error\">".$lang[profil_error_allreadyverified]."</div>";
	}elseif($_SESSION[user][Profil_Handycode]==$_GET[verifycode]){
	    $db->query("UPDATE user SET Profil_Handycode='ok' WHERE Id=".$_SESSION[user][Id]);
		echo "<div class=\"info\">".$lang[profil_handy_verified]."</div>";
	}else{
	    echo "<div class=\"error\">".$lang[profil_error_verified]."</div>";
	}
}
//Informationen in die Datenbank schreiben
if($_POST['do']=="saveProfil")
{
  if(isset($_POST[messengertyp]))
  {
    foreach($_POST[messengertyp] AS $key=>$value) 
    {
      if($_POST[messengernr][$key]!="") $messenger.=$_POST[messengertyp][$key]."=".$_POST[messengernr][$key]."*|*";     
    }
  }
  else $messenger="";
  //Update Session-Variable
  if(isset($_POST[handynummer]) AND $_SESSION[user][Profil_Handycode]==""){
      $db->query("Update user SET Profil_Handynummer='".secstr($_POST[handynummer])."' WHERE Id=".$_SESSION[user][Id].";");
  }
  
  if($_POST[option_planetsort]=="name") $_SESSION[planetsort]="Name ASC";
  elseif($_POST[option_planetsort]=="alter") $_SESSION[planetsort]="Kolonisiert DESC";
  else $_SESSION[planetsort]="Punkte DESC";
  
  $abfrage="
  UPDATE user SET
  Profil_Wohnort='".secstr($_POST[wohnort])."',
  Profil_Beruf='".secstr($_POST[beruf])."',
  Profil_Homepage='".secstr($_POST[homepage])."',
  Profil_Interessen='".secstr($_POST[interessen])."',
  Profil_Signatur='".secstr($_POST[signatur])."',
  Profil_Messenger='".secstr($messenger)."',
  Option_Menue='".secstr($_POST[option_menue])."',
  Option_Compact='".secstr($_POST[option_compact])."',
  Option_Planetsort='".secstr($_POST[option_planetsort])."',
  Option_Fastbuild='".secstr($_POST[option_fastbuild])."',
  Option_Newsletter='".secstr($_POST[option_newsletter])."',
  Option_Tutorial='".secstr($_POST[option_tutorial])."',
  Option_Notify='".intval($_POST[option_notify])."',
  Option_Help='".secstr($_POST[option_help])."'
  WHERE Id=".$_SESSION[user][Id].";";
  $db->query($abfrage);
  //Userdaten neu laden
  $db->query("SELECT * FROM user WHERE Id=".$_SESSION[user][Id]);
  $res=$db->fetch_assoc();
  foreach($res as $key=>$value){
    $_SESSION[user][$key]=$value;
  }
}
//Passwortänderungen speichern
if($_POST['do']=="changepass"){
    if(md5($_POST[old_pass])!=$_SESSION[user][Passwort]){
        //Wrong password  
        echo "<font color=\"red\">".$lang[profil_error_wrongpw]."</font>";
    }elseif($_POST[new_pass1]!=$_POST[new_pass2]){
        //Pws doesn't match
        echo "<font color=\"red\">".$lang[profil_error_wrongpwwh]."</font>";
    }else{
        //Pws match -> change will be saved
        $_SESSION[user][Passwort]=md5($_POST[new_pass1]);
        $db->query("UPDATE user SET Passwort='".$_SESSION[user][Passwort]."' WHERE Id='".$_SESSION[user][Id]."';");
        echo "<font color=\"green\">".$lang[profil_pwchanged]."</font>";
    }
}
//Autologin setzten
if(isset($_GET[autologin])){
    if($_GET[autologin]=="true"){
        $zeichen="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-_";
        $code="";
        do{
            $code.=$zeichen[rand(0,strlen($zeichen)-1)];
        }while(strlen($code)<100);
    }
    else $code="";
    $db->query("UPDATE user SET AutoLogin='$code' WHERE Id=".$_SESSION[user][Id].";");
}
  
//AUSZEICHNUNGEN SPEICHERN
if($_POST['do']=="editAuszeichnungen" AND isset($_POST[auszeichnung])){
    //Vorher alle deselectieren
    $db->query("UPDATE auszeichnungen SET Sichtbar='' WHERE User='".$_SESSION[user][Id]."';");
    foreach($_POST[auszeichnung] AS $key=>$value){
        $db->query("UPDATE auszeichnungen SET Sichtbar='".secstr($value)."' WHERE User='".$_SESSION[user][Id]."' AND Auszeichnung='$key';");
    }
}
//Informationen auslesen
$result=$db->query("SELECT * FROM user WHERE ID='".$_SESSION[user][Id]."';");
$user=$db->fetch_assoc($result);
//Update Session Variable
foreach($user AS $key=>$value){
    $_SESSION[user][$key]=$value;
}
?>
<script type="text/javascript">
messenger=new Array();
nummer=new Array();
<?
$messenger=explode("*|*", $user[Profil_Messenger]);

$a=0;
foreach($messenger AS $value)
{
 if($value!="")
 {
   $wert=explode("=",$value);
   echo "
   messenger[$a]=\"$wert[0]\";
   nummer[$a]=\"$wert[1]\";";
 }
 $a++;
}
?>
function loadMessenger()
{
  var html="<center><b>Messenger</b><table width=\"200px\">";
  feld=document.getElementById("messenger");
  for(var a=0; messenger[a]; a++)
  {
    html+="<tr><th width=\"50%\">"+messenger[a]+":</th>";
    html+="<input type=\"hidden\" name=\"messengertyp["+a+"]\" value=\""+messenger[a]+"\"/>";
    html+="<td width=\"50%\"><input type=\"text\" name=\"messengernr["+a+"]\" value=\""+nummer[a]+"\"/><td></tr>";
  }
  html+="</table>";
  if(messenger.length==0) html="<b>".$lang[profil_nomessanger]."<b>";
  feld.innerHTML=html;
}
function addMessenger(nr)
{
  messenger[nummer.length]=document.getElementById("MessengerSelect").value;
  nummer[nummer.length]=nr;
  loadMessenger();
  
}
</script>
<h1><? echo $lang[profil_pers_top] ?></h1>
<table cellspacing="20">
 <tr>
  <td rowspan="3" valign="top">
   <fieldset style="margin:2px;">
    <legend><? echo $lang[profil_pers_head] ?></legend>
    <form action="<? echo $_SERVER[PHP_SELF]?>" method="post">
     <input type="hidden" name="do" value="saveProfil">
     <table align="center" width="300px;">
      <tr>
       <th><? echo $lang[profil_pers_nickname] ?></th>
       <td>
        <input type="text" name="nickname" value="<? echo $user[Name] ?>" disabled="disabled"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_pers_residence] ?></th>
       <td>
        <input type="text" name="wohnort" value="<? echo $user[Profil_Wohnort] ?>"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_pers_job] ?></th>
       <td>
        <input type="text" name="beruf" value="<? echo $user[Profil_Beruf] ?>"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_pers_homepage] ?></th>
       <td>
        <input type="text" name="homepage" value="<? echo $user[Profil_Homepage] ?>"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_pers_mobile] ?></th>       <td>
	    <?
		if($user[Profil_Handycode]==""){
            echo "<input type=\"text\" id=\"handynummer\" name=\"handynummer\" size=\"7\" value=\"$user[Profil_Handynummer]\"/>";
		}else{
            echo "<input type=\"text\" id=\"handynummer\" name=\"handynummer\" size=\"7\" value=\"$user[Profil_Handynummer]\" readonly=\"readonly\"/>";
		}
		//Verify
		if($user[Profil_Handycode]==""){
		    echo "<input type=\"button\" value=\"verify\" onclick=\"if(confirm('Ist die Nummer '+document.getElementById('handynummer').value+' korrekt? Bitte überprüfe die Nummer damit wir dir einen Auth-Code schicken können.')) location.href='index.php?page=profil&verify='+document.getElementById('handynummer').value;\" />";
        }elseif($user[Profil_Handycode]!="ok"){
		    echo "<input type=\"button\" value=\"code eing.\" onclick=\"location.href='index.php?page=profil&verifycode='+prompt('Bitte trage den Code ein, den wir dir zugesand haben:');\"/>";
		}else{
		    echo "<font color=\"green\">verified</font>";
        }			
		?>
		
       </td>
      </tr>
      <tr>
       <td id="messenger" colspan="2">
       </td>
      </tr>
      <tr>
       <th colspan="2" style="font-size:10px">
        <?echo $lang[profil_messenger_leaveempty];?>
       </th>
      </tr>
      <tr>
       <td align="right">
        <select id="MessengerSelect">
         <option value=""><? echo $lang[profil_pers_do_add] ?></option>
         <option value="ICQ">ICQ</option>
         <option value="AIM">AIM</option>
         <option value="Yahoo">YIM</option>
         <option value="MSN">MSN</option>
         <option value="GTalk">GTalk</option>
         <option value="Skype">Skype</option>
         <option value="Jabber">Jabber</option>
        </select>
       </td>
       <td>
        <input type="text" name="nr" style="width:100px;"id="messengerNummer" onkeypress="if(event.keyCode==13) addMessenger(this.value);"/>
        <input type="button" value="+" onclick="addMessenger(document.getElementById('messengerNummer').value);"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_pers_interests] ?></th>
       <td>
        <input type="text" name="interessen" value="<? echo $user[Profil_Interessen] ?>"/>
       </td>
      </tr>
      <tr>
       <th colspan="2">
        <? echo $lang[profil_pers_signature] ?>
       </th>
      </tr>
      <tr>
       <th colspan="2">
        <textarea name="signatur" cols="30" rows="5"><? echo $user[Profil_Signatur]?></textarea>
       </th>
      </tr>
      <tr>
       <th colspan="2" align="center"><b><? echo $lang[profil_pers_options] ?></b></th>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_planetsort]?></th>
       <td>
        <select name="option_planetsort">
         <?
         echo "<option value=\"name\" "; if($user[Option_Planetsort]=="name") echo "selected=\"selected\""; echo ">".$lang[profil_option_sortbyname]."</option>";
         echo "<option value=\"alter\" "; if($user[Option_Planetsort]=="alter") echo "selected=\"selected\""; echo ">".$lang[profil_option_sortbykolo]."</option>";
         echo "<option value=\"punkte\" "; if($user[Option_Planetsort]=="punkte") echo "selected=\"selected\""; echo ">".$lang[profil_option_sortbypoints]."</option>";
         ?>
        </select>
       </td>        
      </tr>
      <?
      $lang[profil_option_notify]="IGM Notify";
      $lang[profil_option_notify_everytime]="PN/System/Info";
      $lang[profil_option_notify_noinfo]="PN/System";
      $lang[profil_option_notify_nosystem]="PN";
      $lang[profil_option_tutorial]="Tutorial";
      ?>
      <tr>
       <th><?echo $lang[profil_option_notify]?></th>
       <td>
        <select name="option_notify">
         <?
         echo "<option value=\"0\" "; if($user[Option_Notify]=="0") echo "selected=\"selected\""; echo ">".$lang[profil_option_notify_everytime]."</option>";
         echo "<option value=\"2\" "; if($user[Option_Notify]=="2") echo "selected=\"selected\""; echo ">".$lang[profil_option_notify_noinfo]."</option>";
         echo "<option value=\"1\" "; if($user[Option_Notify]=="1") echo "selected=\"selected\""; echo ">".$lang[profil_option_notify_nosystem]."</option>";
         ?>
        </select>
       </td>        
      </tr>
      <tr>
       <th><?echo $lang[profil_option_compactmenue]?></th>
       <td>
        <select name="option_menue">
         <option value="on"><?echo $lang[profil_on]?></option>
         <?
         echo "<option value=\"\" "; if($user[Option_Menue]=="") echo "selected=\"selected\""; echo ">$lang[profil_off]</option>";
         ?>
        </select>
       </td>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_compactview]?></th>
       <td>
        <select name="option_compact">
         <option value="on"><?echo $lang[profil_on]?></option>
         <?
         echo "<option value=\"\" "; if($user[Option_Compact]=="") echo "selected=\"selected\""; echo ">$lang[profil_off]</option>";
         ?>
        </select>
       </td>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_fastbuild]?></th>
       <td>
        <select name="option_fastbuild">
         <option value="hide"><?echo $lang[profil_on]?></option>
         <?
         echo "<option value=\"\" "; if($user[Option_Fastbuild]=="") echo "selected=\"selected\""; echo ">$lang[profil_off]</option>";
         ?>
        </select>
       </td>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_ingamehelp]?></th>
       <td>
        <select name="option_help">
         <option value=""><?echo $lang[profil_on]?></option>
         <?
         echo "<option value=\"hide\" "; if($user[Option_Help]=="hide") echo "selected=\"selected\""; echo ">$lang[profil_off]</option>";
         ?>
        </select>
       </td>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_newsletter]?></th>
       <td>
        <select name="option_newsletter">
        <?
        if($user[Option_Newsletter]!="off") 
          echo "<option value=\"on\" selected=\"selected\">$lang[profil_on]</option>";
        else
          echo "<option value=\"on\">$lang[profil_on]</option>";
        if($user[Option_Newsletter]=="off") 
          echo "<option value=\"off\" selected=\"selected\">$lang[profil_off]</option>";
        else
          echo "<option value=\"off\">$lang[profil_off]</option>";
        ?>
        </select>
       </td>
      </tr>
      <tr>
       <th><?echo $lang[profil_option_tutorial]?></th>
       <td>
        <select name="option_tutorial">
        <?
        if($user[Option_Tutorial]!="off") 
          echo "<option value=\"on\" selected=\"selected\">$lang[profil_on]</option>";
        else
          echo "<option value=\"on\">$lang[profil_on]</option>";
        if($user[Option_Tutorial]=="off") 
          echo "<option value=\"off\" selected=\"selected\">$lang[profil_off]</option>";
        else
          echo "<option value=\"off\">$lang[profil_off]</option>";
        ?>
        </select>
       </td>
      </tr>

      <tr>
       <th colspan="2" align="center">
        <input type="submit" value="<?echo $lang[profil_option_save]?>"/>
       </th>
      </tr>
     </table>
    </form>
    <script type="text/javascript">
     loadMessenger();
    </script>
   </fieldset>
  </td>
  <td valign="top">
   <fieldset style="margin:2px;">
    <legend><?echo $lang[profil_changepw]?></legend>
    <form action="index.php" method="post">
     <input type="hidden" name="do" value="changepass"/>
     <table align="center">
      <tr>
       <th><? echo $lang[profil_oldpw]?></th>
       <td>
        <input type="password" name="old_pass"/>
       </td>
      </tr>
      <tr>
       <th><? echo $lang[profil_newpw]?></th>
       <td>
        <input type="password" name="new_pass1" id="new_pass1" onchange="if(this.value.length<6) alert('Das Passwort sollte min. 6 Zeichen haben!');"/>
       </td>
       </tr>
      <tr>
       <th><? echo $lang[profil_newpwwh]?></th>
       <td>
        <input type="password" name="new_pass2" onchange="if(this.value!=document.getElementById('new_pass1').value) alert('Die beiden Passworter stimmen nicht überein!')"/>
       </td>
      </tr>
      <tr>
       <th colspan="2" align="center">
        <input type="submit" value="<? echo $lang[profil_submitpw]?>"/>
       </th>
      </tr>
     </table>
    </form>
   </fieldset>
  </td>
 </tr>
 <tr>
  <td>
   <fieldset>
    <legend><? echo $lang[profil_autologin]?></legend>
    <? echo $lang[profil_autologin_desc]?><br>
    <input type="checkbox" onchange="location.href='index.php?page=profil&autologin='+this.checked" <?if(strlen($user[AutoLogin])>5) echo "checked=\"checked\"";?>><b>Autologin aktivieren</b><br>
    <div class="info"> <? echo $lang[profil_autologin_warn]?></div>
    <?
    if($user[AutoLogin]!="")
      echo "
      <b>".$lang[profil_autologin_link]."<br>
      <input type=\"text\" size=\"50\" value=\"http://$_SERVER[HTTP_HOST]/".$config_running_folder."index.php?al=$user[AutoLogin]\" />
      <center>
       <a href=\"bts-shortcut.php?url=http://$_SERVER[HTTP_HOST]/".$config_running_folder."index.php?al=$user[AutoLogin]\">$lang[profil_autologin_shortcut]</a>
      </center>";
    ?>      
   </fieldset>
  </td>
 </tr>
 <tr>
  <td valign="top">
   <fieldset style="margin:2px;">
    <legend><? echo $lang[profil_avatar_upload]?></legend>
    <form action="<?echo $_SERVER[PHP_SELF]?>" method="post" enctype="multipart/form-data">
     <input type="hidden" name="page" value="<?echo $_SESSION[page]?>"/>
     <input type="hidden" name="do" value="upload"/>
     <?
     $bild="data/user/user-".$_SESSION[user][Id].".jpg";
     if(file_exists($bild)) $bild="<img src=\"$bild\" alt=\"\" width=\"100\" height=\"75\"/>";
     else $bild="<img src=\"data/user/nopic.jpg\" alt=\"\" width=\"100\" height=\"75\"/>";
     echo "<div style=\"float:left; margin:5px;\">$bild</div>";
     echo $lang[profil_avatar_desc];
     ?>
     <input type="file" name="upload" style="width:100%;" onchange="this.form.submit();"></input>
    </form>
   </fieldset>
  </td>
 </tr>
 <tr>
    <th colspan="2">
      <?
      $error="";
      if($_POST['do']=="urlaub" AND $_SESSION[acid]==$_POST[acid]){
          //Einzelne Serveraccounts nachsehen, ob ein Urlaubsmodus möglich ist
          $result=$db->query("SELECT Id, Urlaub_Bis FROM spieler WHERE User=".$_SESSION[user][Id].";");
          while($line=$db->fetch_assoc($result)){
              //Flüge überprüfen
              if($db->num_rows($db->query("SELECT Id FROM kommander WHERE Ziel_Spieler='$line[Id]' AND (Auftrag='att' OR Auftrag='gematt');"))>0){
                  //can't leave because there are running attacks
                  $error=$lang[profil_error_underattack];
                  if (empty($error)) $error = "You are under attack.";
              }
              if($line[Urlaub_Bis]>date(U)-$config[keinurlaub]){
                  $error=$lang[profil_error_noholidays];
                  if (empty($error)) $error = "Your last holiday is not long enough ago."; 
              }
          } //ende while
          if($error==""){
              $db->query("UPDATE spieler SET Urlaub_Bis=".(date(U)+(intval($_POST[urlaubszeit])*3600*24)).", Urlaub_Grund='".secstr($_POST[meldung])."' WHERE User=".$_SESSION[user][Id].";");
              echo "<div class=\"info\">$lang[profil_holidaymode_activated]</div>";
          }else{
              echo "<div class=\"error\">$error</div>";
          }
      }
      $_SESSION[acid]=rand(100000000,9999999999);
      ?>
      <fieldset>
        <legend><? echo $lang[profil_holidaymode]?></legend>
        <?
        //Aktuellen Urlaubsmodus ermitteln
        $result=$db->query("SELECT MAX(Urlaub_Bis) AS umode FROM spieler WHERE User=".$_SESSION[user][Id].";");
        if($db->num_rows($result) > 0){
            $umode=$db->result(0,"umode");
        }else{
            $umode=0;
        }
        if($umode>date(U)){
            //Umode active
            echo sprintf($lang[profil_umode_until],date("d.m.Y - H:i:s",$umode));
        }elseif($umode>date(U)-$config_keinurlaub){
            echo sprintf($lang[profil_umode_notpossible],date("d.m.Y - H:i:s",$umode+$config_keinurlaub)).".";
        }else{
            echo $lang[profil_umode_desc];
            ?>            
            <br>
            <form action="index.php" method="post" onsubmit="if(!confirm('<?echo $lang[profil_umode_confirm]?>')) return false;">
              <input type="hidden" name="acid" value="<?echo $_SESSION[acid]?>">
              <input type="hidden" name="do" value="urlaub" />
              <b><?echo $lang[profil_umode_activatefor]?>
              <select name="urlaubszeit">
                <?
                for($i=3;$i<30;$i++){
                    echo "<option value=\"$i\">$i Tage</option>";
                }
                ?>
              </select>
              <b><? echo $lang[profil_umode_message]?>:</b>
              <input type="text" name="meldung" value="<?echo $lang[profil_umode_messagebsp]?>" />
              <input type="submit" value="<? echo $lang[profil_umode_set]?>" />
            </form>
        <?
        }
        ?>
      </fieldset>
    </th>
  </tr>
</table>
    

<h1><? echo $lang[profil_avards]?></h1>
<? echo $lang[profil_avards_desc]?>

<form action="index.php" method="post">
 <input type="hidden" name="do" value="editAuszeichnungen"/>
 <table>
 <?
 include("conf/auszeichnungen.conf.php");
 $result=$db->query("SELECT * FROM auszeichnungen WHERE User='".$_SESSION[user][Id].";';");
 $anzahl=$db->num_rows($result);
 $a=0;
 while($a<$anzahl)
 {
   echo "<tr>";
   for($i=0;$i<4;$i++)
   {
     echo "<td align=\"center\">";
     if($a<$anzahl) 
     {
       $auszeichnung=$db->result($a,"Auszeichnung");
       echo "<img src=\"".$config_auszeichnung[$auszeichnung][img]."\" width=\"70\" height=\"50\"><br>".
       $config_auszeichnung[$auszeichnung][name]."<br>
       <input type=\"checkbox\" name=\"auszeichnung[$auszeichnung]\"";
       if($db->result($a,"Sichtbar")=="on") echo " checked=\"checked\"";
       echo "/>sichtbar";
     }
     echo "</td>";
     $a++;
   }
   echo "</tr>";
 }
 ?>
 </table>
 <center>
  <input type="submit" value="<? echo $lang[profil_submitpw]?>"/>
 </center>
</form>


